home *** CD-ROM | disk | FTP | other *** search
- /* Dice: 1> dcc -l0 -mD dpk.o tags.o PenTest.c -o PenTest
- **
- ** Pen demo.
- */
-
- #include <proto/dpkernel.h>
-
- BYTE *ProgName = "Pen Test";
- BYTE *ProgAuthor = "Paul Manias";
- BYTE *ProgDate = "August 1998";
- BYTE *ProgCopyright = "DreamWorld Productions (c) 1996-1998. Freely distributable.";
- BYTE *ProgShort = "Draws lots of different pen based lines.";
-
- void main(void)
- {
- struct GScreen *Screen;
- struct JoyData *JoyData;
- LONG palette[] = { PALETTE_ARRAY, 4, 0x000000L, 0xf080f0L, 0x80f0f0, 0xf0f080 };
- WORD sx,sy,ex,ey;
- LONG mask;
-
- if (Screen = InitTags(NULL,
- TAGS_SCREEN, NULL,
- GSA_BitmapTags, NULL,
- BMA_Palette, palette,
- TAGEND, NULL,
- TAGEND)) {
-
- if (JoyData = Init(Get(ID_JOYDATA),NULL)) {
-
- Display(Screen);
-
- /*** Pattern 1 ***/
-
- SetPenShape(Screen->Bitmap,PSP_CIRCLE,2);
- SetRGBPen(Screen->Bitmap,0xf080f0L);
-
- sx=0; sy=0; ex=0; ey=Screen->Bitmap->Height-1;
- for (ex=0; ex < Screen->Bitmap->Width; ex++) {
- PenLinePxl(Screen->Bitmap,sx,sy,ex,ey,0x0f0f0f0f);
- }
-
- SetRGBPen(Screen->Bitmap,0x80f0f0L);
- for (ey=Screen->Bitmap->Height-1; ey > 0; ey--) {
- PenLinePxl(Screen->Bitmap,sx,sy,ex,ey,0x0f0f0f0f);
- }
-
- WaitTime(50);
-
- /*** Clear pattern 1 ***/
-
- SetRGBPen(Screen->Bitmap,0x000000L);
- sx=0; sy=0; ex=0; ey=Screen->Bitmap->Height-1;
- for (ex=0; ex < Screen->Bitmap->Width; ex++) {
- PenLinePxl(Screen->Bitmap,sx,sy,ex,ey,0xffffffff);
- }
- for (ey=Screen->Bitmap->Height-1; ey > 0; ey--) {
- PenLinePxl(Screen->Bitmap,sx,sy,ex,ey,0xffffffff);
- }
-
- WaitTime(10);
-
- /*** Pattern 2 ***/
-
- SetRGBPen(Screen->Bitmap,0xf0f080L);
- sx=0; sy=0; ex=0; ey=Screen->Bitmap->Height-1;
- mask = 0xAAAAAAAA;
- for (ex=0; ex < Screen->Bitmap->Width; ex++) {
- PenLinePxl(Screen->Bitmap,sx,sy,ex,ey,mask);
- mask = ~mask;
- sx++;
- }
-
- WaitTime(50);
-
- /*** Clear pattern 2 ***/
-
- mask = 0xffffffff;
- SetRGBPen(Screen->Bitmap,0x000000L);
- sx=0; sy=Screen->Bitmap->Height-1; ex=Screen->Bitmap->Width-1; ey=Screen->Bitmap->Height-1;
- for (sy=Screen->Bitmap->Height-1; sy >= 0; sy--) {
- PenLinePxl(Screen->Bitmap,sx,sy,ex,ey,mask);
- ey--;
- }
-
- WaitTime(50);
-
- Free(JoyData);
- }
- Free(Screen);
- }
- }
-
-